﻿using SW.Lite.Infrastructure.Common;
using SW.Lite.Model.Master;

namespace SW.Lite.IDAL.Master
{
    public interface IAdmin
    {
        /// <summary>
        ///     数据是否存在
        /// </summary>
        /// <param name="id"></param>
        bool Exists(int id);

        /// <summary>
        ///     获取单个项
        /// </summary>
        /// <param name="id"></param>
        AdminModel Single(int id);

        /// <summary>
        ///     获取单个项
        /// </summary>
        /// <param name="userName">用户名</param>
        AdminModel Single(string userName);

        /// <summary>
        ///     获取所有项目
        /// </summary>
        PageList<AdminModel> All();

        /// <summary>
        ///     获取所有项目(分页)
        /// </summary>
        PageList<AdminModel> All(int pageIndex, int pageSize);

        /// <summary>
        ///     插入数据
        /// </summary>
        ExecuteResult Insert(AdminModel item);

        /// <summary>
        ///     更新数据
        /// </summary>
        ExecuteResult Update(AdminModel item);

        /// <summary>
        ///     删除数据
        /// </summary>
        /// <param name="ids">ID列表</param>
        ExecuteResult Delete(params int[] ids);

        /// <summary>
        ///     添加管理员角色
        /// </summary>
        /// <param name="adminId">管理员ID</param>
        /// <param name="deleteAllBeforeAdd">删除前清空已有记录</param>
        /// <param name="roleIds">角色ID列表</param>
        ExecuteResult AddAdminRoles(int adminId, bool deleteAllBeforeAdd, params int[] roleIds);
    }
}